﻿using System.Collections.Generic;

namespace com.foxmail.wyyuan1991.Assignment
{
    /// <summary>
    /// 配流结果
    /// </summary>
    public class FlowPattern : IFlowPattern
    {
        private Dictionary<IArc, double> _Dic = new Dictionary<IArc, double>();
        public double getFlow(IArc a)
        {
            return _Dic.ContainsKey(a) ? _Dic[a] : 0;
        }
        public void setFlow(IArc a, double value)
        {
            if (!_Dic.ContainsKey(a)) _Dic.Add(a, 0);
            _Dic[a] = value;
        }
        public void addFlow(IArc a, double value)
        {
            if (!_Dic.ContainsKey(a)) _Dic.Add(a, 0);
            _Dic[a] += value;
        }
    }

}
